<?php

/**
 * @author @author Samrat Khan & Sadik Sarfaraz - Apr 13, 2013
 */
/**
 * 
 * @param string $db Common database connection string parameter
 * @return string $CI returns typename from shiptype table
 */
function getShipTypes($db) {
    $query = "SELECT shiptype_id, typename FROM shiptype";
        try {
            $stmt = $db->prepare($query);
            $stmt->execute();
        } catch (PDOException $ex) {
            die("Failed to run query: " . $ex->getMessage());
        }
        $rows = $stmt->fetchAll();

        foreach($rows as $row1) {
            $CI.="<option value='{$row1["shiptype_id"]}' id='open{$row1["shiptype_id"]}'>";
                $CI.=$row1['typename'];
            $CI.="</option>";
            $CI++;
        }
        return $CI;
}
?>
